﻿<Window x:Class="AutoLoL.Dialogs.ImportLolmDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:converters="clr-namespace:AutoLoL.Converters"
        Title="Import Masteries"
        Height="430"
        Width="629"
        x:Name="Window"
        Icon="/Icon.ico"
        WindowStartupLocation="CenterOwner">
    <Window.Resources>
        <converters:MasteryBuildToIntConverter x:Key="MasteryBuildToIntConverter" />
    </Window.Resources>
    <DockPanel LastChildFill="True" Margin="10">
        <DockPanel DockPanel.Dock="Right">
            <Button Width="75" Height="23" Command="{Binding BrowseCommand}" HorizontalContentAlignment="Left" DockPanel.Dock="Top" Margin="0 20 0 0">
                <Button.Content>
                    <StackPanel Orientation="Horizontal">
                        <Image Height="16" Width="16" Source="pack://siteoforigin:,,,/Data/Images/Icons/folder.png" />
                        <TextBlock Margin="5 0 0 0" Text="Browse" />
                    </StackPanel>
                </Button.Content>
            </Button>
            <Button Content="Check All" Command="{Binding CheckAllCommand}" Height="23" Width="75" DockPanel.Dock="Top" Margin="0 10 0 0" />
            <Button Content="Check None" Command="{Binding UnCheckAllCommand}" Height="23" Width="75" DockPanel.Dock="Top" Margin="0 5 0 0" />
            <Button Content="Import" Command="{Binding ImportCommand}" Height="23" Width="75" DockPanel.Dock="Bottom" VerticalAlignment="Bottom" />
        </DockPanel>

        <StackPanel DockPanel.Dock="Top" Margin="0 0 10 0">
            <TextBlock Text="Please select your old 'Saves' directory" />
            <TextBox Text="{Binding SelectedDirectory}" IsReadOnly="True" Height="23" Margin="0 2 0 0" />
        </StackPanel>

        <DataGrid ItemsSource="{Binding LolmFiles}" Name="BuildsDataGrid" RowHeaderWidth="0" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserResizeRows="False" SelectionMode="Single" SelectionUnit="FullRow" AutoGenerateColumns="False" Margin="0 10 10 0">
            <DataGrid.Columns>
                <DataGridTemplateColumn Header="Import" Width="50">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox IsChecked="{Binding Path=IsChecked, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" HorizontalAlignment="Center" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Header="" Width="38">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button x:Name="btn32x32" Cursor="Hand" CommandParameter="{Binding}" Command="{Binding DataContext.ChangeChampionCommand, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}">
                                <Button.Template>
                                    <ControlTemplate>
                                        <Image Width="32" Height="32" Source="{Binding Path=ChampionBuild.Champion.IconBitmapImage}" />
                                    </ControlTemplate>
                                </Button.Template>
                            </Button>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTextColumn Header="Title" Width="*" Binding="{Binding Path=ChampionBuild.Title, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" IsReadOnly="False" FontSize="13" Selector.IsSelected="True" />
                <DataGridTemplateColumn Header="Masteries" Width="124">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" Margin="2 0 0 0">
                                <Grid Width="44">
                                    <Image Height="18" Width="18" Source="pack://siteoforigin:,,,/Data/Images/Icons/offense.png" HorizontalAlignment="Left" />
                                    <TextBlock Text="{Binding Path=ChampionBuild.MasteryBuild, Converter={StaticResource MasteryBuildToIntConverter}, ConverterParameter='0,14'}" FontSize="14" VerticalAlignment="Center" Margin="0 0 8 0" HorizontalAlignment="Right" />
                                </Grid>
                                <Grid Width="36">
                                    <Image Height="18" Width="18" Source="pack://siteoforigin:,,,/Data/Images/Icons/defense.png" HorizontalAlignment="Left" />
                                    <TextBlock Text="{Binding Path=ChampionBuild.MasteryBuild, Converter={StaticResource MasteryBuildToIntConverter}, ConverterParameter='14,14'}" FontSize="14" VerticalAlignment="Center" Margin="0 0 4 0" HorizontalAlignment="Right" />
                                </Grid>
                                <Grid Width="40">
                                    <Image Height="18" Width="18" Source="pack://siteoforigin:,,,/Data/Images/Icons/utility.png" HorizontalAlignment="Left" />
                                    <TextBlock Text="{Binding Path=ChampionBuild.MasteryBuild, Converter={StaticResource MasteryBuildToIntConverter}, ConverterParameter='28,15'}" FontSize="14" VerticalAlignment="Center" Margin="0 0 4 0" HorizontalAlignment="Right" />
                                </Grid>
                            </StackPanel>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Header="Spells" Width="80">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                <Grid Background="#22000000" Height="28" Width="28">
                                    <Image Source="{Binding Path=ChampionBuild.SummonerSpells[0].IconBitmapImage}" />
                                </Grid>
                                <Grid Background="#22000000" Height="28" Width="28" Margin="5 0 0 0">
                                    <Image Source="{Binding Path=ChampionBuild.SummonerSpells[1].IconBitmapImage}" />
                                </Grid>
                            </StackPanel>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
        </DataGrid>
    </DockPanel>
</Window>
